package biolabs.core;

/**
 * Listener for experiment's events.
 *
 * @author Tomas Mikula
 */
public interface ExperimentListener {

	/**
	 * Called when the experiment has been closed.
	 * @param exp the closed experiment
	 */
	void experimentClosed(Experiment exp);

	/**
	 * Called when the experiment has started (or resumed).
	 * On a call to this method, the experiment is running.
	 * It will not be able to acquire a read or write lock on
	 * the experiment until it is stopped. Without a lock it is
	 * legal to access only immutable state of the experiment,
	 * which are basically just {@link Experiment#getName()}
	 * and {@link Experiment#toString()} methods.
	 * @param exp the started/resumed experiment
	 */
	void experimentStarted(Experiment exp);

	/**
	 * Called when the experiment has stopped.
	 * On a call to this method, the experiment is stopped (i.e. not running).
	 * If this listener acquires a read or write lock on the experiment,
	 * it is guaranteed to stay stopped until that lock is unlocked.
	 * @param exp the experiment that has stopped
	 */
	void experimentStopped(Experiment exp);
}
